<template>
  <div>
    <van-cell-group>
      <van-cell :value="record.kcname" title="课程名称"/>
      <van-cell :value="record.name" title="教师姓名"/>
      <van-cell :value="record.price" title="单节课费用"/>
      <van-cell :value="record.number" title="剩余课时"/>
      <van-cell :value="record.statusStr" title="缴费情况"/>
      <van-cell :value="record.total_price" title="已缴金额"/>
    </van-cell-group>
  </div>
</template>

<script>
import api from '@/api'
export default {
  name: 'cost-record',
  data () {
    return {
      record: {
        kcname: '',
        name: '',
        price: 0,
        number: 0,
        status: 0,
        total_price: 0,
        statusStr: ''
      }
    }
  },
  methods: {
    getInfo () {
      let params = {
        id: this.$route.query.id,
        student_id: this.$route.query.sid
      }
      api.platformCoursePay({
        params,
        callback: res => {
          if (res.data.error_code === 0) {
            Object.keys(this.record).forEach(key => {
              this.record[key] = res.data.data[key]
            })
            this.record.status === 1 ? this.record.statusStr = '已缴清' : this.record.statusStr = '未缴清'
          }
        }
      })
    }
  },
  created () {
  }
}
</script>

<style scoped>
  .van-cell div:nth-child(2) span{
    color: #2D2D2D;
  }
</style>
